package service.webapps.demo2;

import service.AbstractHttpServlet;
import service.HttpProtocolUtil;
import service.Request;
import service.Response;

import java.io.IOException;

/**
 * @author: jie.zhao
 * @create: 2021/03/21 11:00
 */
public class LaGouServlet extends AbstractHttpServlet {
    @Override
    public void doGet(Request request, Response response) {
        String content = "<h1>hello World get2<h1>";
        try {
            response.outPut(HttpProtocolUtil.getHeader200(content.getBytes().length)+content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1>hello World post<h1>";
        try {
            response.outPut(HttpProtocolUtil.getHeader200(content.getBytes().length)+content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}
